﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace QLThuVien
{
    public partial class frDanhSachMuon : Form
    {
        public frDanhSachMuon()
        {
            InitializeComponent();
        }

        private void frDanhSachMuon_Load(object sender, EventArgs e)
        {
            KetNoi.setconnect();
            DataTable dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter("SELECT *FROM LOAIDOCGIA,DOCGIA,SACH_PHIEU,PHIEUMUON,SACH WHERE DOCGIA.MADOCGIA=PHIEUMUON.MADOCGIA AND DOCGIA.MALOAIDOCGIA=LOAIDOCGIA.MALOAIDOCGIA AND PHIEUMUON.MAPHIEU=SACH_PHIEU.MAPHIEU AND SACH_PHIEU.MASACH=SACH.MASACH AND SACH_PHIEU.NGAYTRA IS NULL", KetNoi.scn);
            da.Fill(dt);
            DataColumn dc = new DataColumn();
            dt.Columns.Add(dc);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                listView1.Items.Add(dt.Rows[i]["MADOCGIA"].ToString());
                listView1.Items[i].SubItems.Add(dt.Rows[i]["HOTEN"].ToString());
                listView1.Items[i].SubItems.Add(dt.Rows[i]["TENLOAIDG"].ToString());
                listView1.Items[i].SubItems.Add(dt.Rows[i]["MASACH"].ToString());
                listView1.Items[i].SubItems.Add(dt.Rows[i]["TENSACH"].ToString());
                listView1.Items[i].SubItems.Add(dt.Rows[i]["NGAYMUON"].ToString());
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
        }

    }
}
